#pragma once
#include <string>
#include <windows.h>
#include "shpa3api.h"
#include <vector>
//#include "Extension.h"
//#include "TrunkChannel.h"
#include "DeviceStatePool.h"
#include "..\TinyVoiceCardServer\CardPool.h"

class CExtension;
class CTrunkChannel;

using namespace DeviceStates;

class CTinySanhuiCardPool :public CCardPool
{
public:
	CTinySanhuiCardPool(void);
	~CTinySanhuiCardPool(void);
	static int CALLBACK CardCallBackProc(WORD wEvent, int nReference, DWORD dwParam, DWORD dwUser);
	virtual void ProcessReceivedMsg(CTinyMsg &inMsg,CTinyMsg &OutMsg);
	bool init(void);
	void initAllDevice(void);
	void processTimer(std::string timerID);
private:
	char szErrMsg[400];
	int nTimer;
	std::vector<CTrunkChannel*> m_trunkVec;
	std::vector<CExtension*> m_userVec;
	std::string getBoardType(int index);
	void registerDevice(std::string cardID,std::string cardSN,std::string deviceType,int channelID,std::string deviceID);
public:
	bool m_initialized;
	int m_nChannelNum;
	CDevice* getDeviceByChannelID(int id);
	CDevice* getDeviceByID(std::string deviceID);
	std::string m_DeviceRegisterTimer;
};
